package com.vne.skyemart.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "Payment",catalog = "skyemart_db")
public class Payment implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1468028627731852751L;

	@Id
	@GeneratedValue
	@Column(name = "PaymentID",nullable = false,unique = true)
	private int paymentID;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PayMentTypeID",nullable = false)
	private PaymentType paymentType;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CartID",nullable = false)
	private Cart cart;

	@Column(name = "TotalAmount",nullable = false)
	private double totalAmount = 0;

	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "StatusID",nullable = false)
	private Status status;
	/**
	 * CONSTRUCTOR
	 */
	public Payment() {}
	
	public Payment(int paymentID, PaymentType paymentType, Cart cart,
			double totalAmount, Status status) {
		super();
		this.paymentID = paymentID;
		//this.paymentType = paymentType;
		this.cart = cart;
		this.totalAmount = totalAmount;
		//this.status = status;
	}
		
	/**
	 * GETTER AND SETTER
	 * 
	 */
	public int getPaymentID() {
		return paymentID;
	}
	public void setPaymentID(int paymentID) {
		this.paymentID = paymentID;
	}
	public PaymentType getPaymentType() {
		return paymentType;
	}
	public void setPaymentType(PaymentType paymentType) {
		this.paymentType = paymentType;
	}
	public Cart getCart() {
		return cart;
	}
	public void setCart(Cart cart) {
		this.cart = cart;
	}
	public double getTotalAmount() {
		return totalAmount;
	}
	public void setTotalAmount(double totalAmount) {
		this.totalAmount = totalAmount;
	}
	public Status getStatus() {
		return status;
	}
	public void setStatus(Status status) {
		this.status = status;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
}
